{"id":11022,"date":"2016-11-23T15:33:37","date_gmt":"2016-11-23T20:33:37","guid":{"rendered":"https:\/\/www.gravityhelp.com\/?p=11022"},"modified":"2018-05-30T19:56:17","modified_gmt":"2018-05-30T19:56:17","slug":"gravity-forms-rest-api-v2-beta-1-released","status":"publish","type":"post","link":"https:\/\/www.gravityforms.com\/gravity-forms-rest-api-v2-beta-1-released\/","title":{"rendered":"Gravity Forms REST API v2 Beta 1 Released"},"content":{"rendered":"<p><strong>Update 30 December 2016: see the release notes for\u00a0<a href=\"\/gravity-forms-rest-api-v2-beta-2-released\/\">Gravity Forms REST API v2 Beta 2<\/a>.<\/strong><\/p>\n<p>The Gravity Forms REST API version 2.0-beta-1 is now available on the <a href=\"\/my-account\/downloads\/\">downloads<\/a> page. This a developer-focused, feature plugin which contains\u00a0version 2 of the current\u00a0<a href=\"https:\/\/docs.gravityforms.com\/web-api\/\">Web\/REST API<\/a> and\u00a0it will ultimately become part of the Gravity Forms core.<br \/>\n<!--more--><\/p>\n<p>The aim\u00a0of version 2 is\u00a0to dovetail with the WordPress REST API in terms of routing, discovery, authentication, usage,\u00a0extensibility and best practices. It also\u00a0provides the solid foundation we need for the development of future versions of Gravity Forms and add-ons.<\/p>\n<p>Version 2 will work alongside\u00a0version 1\u00a0but users will have the option to turn off version 1. Support for version 1 will be phased out so it's very important that\u00a0developers begin\u00a0adding support for version 2 now.<\/p>\n<p>Please send all your bug reports, questions and comments\u00a0by opening a <a href=\"https:\/\/www.gravityforms.com\/support\/\">support ticket<\/a>.\u00a0The development version of the plugin can be found in the public <a href=\"https:\/\/github.com\/gravityforms\/gravityformsrestapi\">repository<\/a> on GitHub.<\/p>\n<h2>Upgrading to Version 2<\/h2>\n<p>The API is largely the same as the current version 1. The endpoints are the same and the same signature\u00a0authentication mechanism is still supported alongside WordPress cookie authentication.<\/p>\n<p>The following <strong>breaking changes<\/strong> are required by clients to consume version 2:<\/p>\n<h3>Content-Type<\/h3>\n<p>The API accepts both standard form fields and JSON content types. When sending JSON, the content-type request header must be set to \"application\/json\". If the content-type is omitted then the request will be interpreted as \"application\/x-www-form-urlencoded\".<\/p>\n<h3><a id=\"user-content-example\" class=\"anchor\" href=\"https:\/\/github.com\/gravityforms\/gravityformsrestapi#example\"><\/a><a id=\"user-content-no-response-envelope\" class=\"anchor\" href=\"https:\/\/github.com\/gravityforms\/gravityformsrestapi#no-response-envelope\"><\/a>No Response Envelope<\/h3>\n<p>The response will not be enveloped by default as in version 1. This means that the response will not be a JSON string containing the \"status\" and \"response\" - the body will contain the response and the HTTP code will contain the status code.<\/p>\n<p>The WP-API will envelope the response if the <em>_envelope<\/em> parameter is included in the request.<\/p>\n<h3><a id=\"user-content-wordpress-cookie-authentication-nonce\" class=\"anchor\" href=\"https:\/\/github.com\/gravityforms\/gravityformsrestapi#wordpress-cookie-authentication-nonce\"><\/a>WordPress Cookie Authentication Nonce<\/h3>\n<p>The \"gf_api\" nonce is no longer supported. Use the WordPress cookie authentication provided by the WP API instead. Create the nonce using wp_create_nonce( 'wp_rest' ) and send it in the _wpnonce data parameter (either POST data or in the query for GET requests), or via the X-WP-Nonce header.<\/p>\n<h3><a id=\"user-content-form-submissions\" class=\"anchor\" href=\"https:\/\/github.com\/gravityforms\/gravityformsrestapi#form-submissions\"><\/a>Form Submissions<\/h3>\n<p>The Form Submissions endpoint now accepts application\/json, application\/x-www-form-urlencoded and multipart\/form-data content types. With the introduction of support for the multipart\/form-data content type files can be sent to single file upload fields.<\/p>\n<p>Request values should be sent all together instead of in separate elements for input_values, field_values, target_page and source_page.<\/p>\n<p><strong>Example body of a JSON form submission:<\/strong><\/p>\n<div class=\"highlight highlight-source-json\">\n<pre>{\r\n    <span class=\"pl-s\"><span class=\"pl-pds\">\"<\/span>input_1<span class=\"pl-pds\">\"<\/span><\/span>: <span class=\"pl-s\"><span class=\"pl-pds\">\"<\/span>test<span class=\"pl-pds\">\"<\/span><\/span>,\r\n    <span class=\"pl-s\"><span class=\"pl-pds\">\"<\/span>field_values<span class=\"pl-pds\">\"<\/span><\/span> : <span class=\"pl-s\"><span class=\"pl-pds\">\"<\/span><span class=\"pl-pds\">\"<\/span><\/span>,\r\n    <span class=\"pl-s\"><span class=\"pl-pds\">\"<\/span>source_page<span class=\"pl-pds\">\"<\/span><\/span>: <span class=\"pl-c1\">1<\/span>,\r\n    <span class=\"pl-s\"><span class=\"pl-pds\">\"<\/span>target_page<span class=\"pl-pds\">\"<\/span><\/span>: <span class=\"pl-c1\">0<\/span>\r\n}<\/pre>\n<\/div>\n<h3><a id=\"user-content-post-single-resources\" class=\"anchor\" href=\"https:\/\/github.com\/gravityforms\/gravityformsrestapi#post-single-resources\"><\/a>POST Single Resources<\/h3>\n<p>In order to maintain consistency with the WP API, the POST \/entries and POST \/forms endpoints no longer accept collections. This means that it's no longer possible to create multiple entries or forms in a single request.<\/p>\n<p>&nbsp;<\/p>\n<p>For further technical details, check out the readme.md file in the plugin folder.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Update 30 December 2016: see the release notes for&nbsp;Gravity Forms REST API v2 Beta 2. The Gravity Forms REST API version 2.0-beta-1 is now available on the downloads page. This a developer-focused, feature plugin which contains&nbsp;version 2 of","protected":false},"author":1533,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[216],"tags":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v16.5 (Yoast SEO v16.5) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Gravity Forms REST API v2 Beta 1 Released | Gravity Forms<\/title>\n<meta name=\"description\" content=\"The Gravity Forms REST API version 2.0-beta-1 is now available on the downloads page. This a developer-focused, feature plugin which contains\u00a0version 2 of the current\u00a0Web\/REST API and\u00a0it will ultimately become part of the Gravity Forms core.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.gravityforms.com\/gravity-forms-rest-api-v2-beta-1-released\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Gravity Forms REST API v2 Beta 1 Released\" \/>\n<meta property=\"og:description\" content=\"Update 30 December 2016: see the release notes for\u00a0Gravity Forms REST API v2 Beta 2. The Gravity Forms REST API version 2.0-beta-1 is now available on the\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.gravityforms.com\/gravity-forms-rest-api-v2-beta-1-released\/\" \/>\n<meta property=\"og:site_name\" content=\"Gravity Forms\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/GravityForms\" \/>\n<meta property=\"article:published_time\" content=\"2016-11-23T20:33:37+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2018-05-30T19:56:17+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@GravityForms\" \/>\n<meta name=\"twitter:site\" content=\"@GravityForms\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.gravityforms.com\/#organization\",\"name\":\"Gravity Forms\",\"url\":\"https:\/\/www.gravityforms.com\/\",\"sameAs\":[\"https:\/\/www.facebook.com\/GravityForms\",\"https:\/\/twitter.com\/GravityForms\"],\"logo\":{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/www.gravityforms.com\/#logo\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/www.gravityforms.com\/wp-content\/uploads\/2018\/06\/gravity_forms_logo.jpg\",\"contentUrl\":\"https:\/\/www.gravityforms.com\/wp-content\/uploads\/2018\/06\/gravity_forms_logo.jpg\",\"width\":268,\"height\":294,\"caption\":\"Gravity Forms\"},\"image\":{\"@id\":\"https:\/\/www.gravityforms.com\/#logo\"}},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.gravityforms.com\/#website\",\"url\":\"https:\/\/www.gravityforms.com\/\",\"name\":\"Gravity Forms\",\"description\":\"WordPress Contact Forms\",\"publisher\":{\"@id\":\"https:\/\/www.gravityforms.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":\"https:\/\/www.gravityforms.com\/?s={search_term_string}\",\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.gravityforms.com\/gravity-forms-rest-api-v2-beta-1-released\/#webpage\",\"url\":\"https:\/\/www.gravityforms.com\/gravity-forms-rest-api-v2-beta-1-released\/\",\"name\":\"Gravity Forms REST API v2 Beta 1 Released | Gravity Forms\",\"isPartOf\":{\"@id\":\"https:\/\/www.gravityforms.com\/#website\"},\"datePublished\":\"2016-11-23T20:33:37+00:00\",\"dateModified\":\"2018-05-30T19:56:17+00:00\",\"description\":\"The Gravity Forms REST API version 2.0-beta-1 is now available on the downloads page. This a developer-focused, feature plugin which contains\\u00a0version 2 of the current\\u00a0Web\/REST API and\\u00a0it will ultimately become part of the Gravity Forms core.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.gravityforms.com\/gravity-forms-rest-api-v2-beta-1-released\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.gravityforms.com\/gravity-forms-rest-api-v2-beta-1-released\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.gravityforms.com\/gravity-forms-rest-api-v2-beta-1-released\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Gravity Forms\",\"item\":\"https:\/\/www.gravityforms.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"News &amp; Updates\",\"item\":\"https:\/\/www.gravityforms.com\/category\/news\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Gravity Forms REST API v2 Beta 1 Released\"}]},{\"@type\":\"Article\",\"@id\":\"https:\/\/www.gravityforms.com\/gravity-forms-rest-api-v2-beta-1-released\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.gravityforms.com\/gravity-forms-rest-api-v2-beta-1-released\/#webpage\"},\"author\":{\"@id\":\"https:\/\/www.gravityforms.com\/#\/schema\/person\/b4248dc0aac3c54d1a5119a9bd34277b\"},\"headline\":\"Gravity Forms REST API v2 Beta 1 Released\",\"datePublished\":\"2016-11-23T20:33:37+00:00\",\"dateModified\":\"2018-05-30T19:56:17+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.gravityforms.com\/gravity-forms-rest-api-v2-beta-1-released\/#webpage\"},\"wordCount\":482,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.gravityforms.com\/#organization\"},\"articleSection\":[\"News &amp; Updates\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.gravityforms.com\/gravity-forms-rest-api-v2-beta-1-released\/#respond\"]}]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.gravityforms.com\/#\/schema\/person\/b4248dc0aac3c54d1a5119a9bd34277b\",\"name\":\"Steve Henty\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/www.gravityforms.com\/#personlogo\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/0bb079bc87d324e56b640a96b35124ac?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/0bb079bc87d324e56b640a96b35124ac?s=96&d=mm&r=g\",\"caption\":\"Steve Henty\"},\"url\":\"https:\/\/www.gravityforms.com\/author\/stevehenty\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","_links":{"self":[{"href":"https:\/\/www.gravityforms.com\/wp-json\/wp\/v2\/posts\/11022"}],"collection":[{"href":"https:\/\/www.gravityforms.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.gravityforms.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.gravityforms.com\/wp-json\/wp\/v2\/users\/1533"}],"replies":[{"embeddable":true,"href":"https:\/\/www.gravityforms.com\/wp-json\/wp\/v2\/comments?post=11022"}],"version-history":[{"count":0,"href":"https:\/\/www.gravityforms.com\/wp-json\/wp\/v2\/posts\/11022\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.gravityforms.com\/wp-json\/wp\/v2\/media?parent=11022"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.gravityforms.com\/wp-json\/wp\/v2\/categories?post=11022"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.gravityforms.com\/wp-json\/wp\/v2\/tags?post=11022"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}